]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
quickSettings: Rename 'label' property to 'title'
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Mon, 30 Jan 2023 20:32:39 +0000 (17:32 -0300)
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Sat, 4 Feb 2023 17:50:36 +0000 (14:50 -0300)
We'll soon add a subtitle, so rename the label property to something
that is a bit more semantic.Add a warning when trying to set the old
'label' property.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2619>

data/theme/gnome-shell-sass/widgets/_quick-settings.scss
js/ui/quickSettings.js
js/ui/status/autoRotate.js
js/ui/status/bluetooth.js
js/ui/status/darkMode.js
js/ui/status/network.js
js/ui/status/nightLight.js
js/ui/status/powerProfiles.js
js/ui/status/rfkill.js
js/ui/status/system.js

index 00bd69adc8bab6bf58f54bf6f87fe1ef55c17f38..54d169321a3023503a13e109d7f851edaacc5167 100644 (file)
@@ -30,7 +30,7 @@
   &:ltr > StBoxLayout { padding-left: $base_padding*2.5; }
   &:rtl > StBoxLayout { padding-right: $base_padding*2.5; }
 
-  .quick-toggle-label { font-weight: bold; }
+  .quick-toggle-title { font-weight: bold; }
   .quick-toggle-icon, .quick-toggle-arrow { icon-size: $base_icon_size; }
 }
 
index 214ca49014fbd9e11bbd33bee210760916f955a0..c07cdcadd551365491af695b3c447f5a619f6265 100644 (file)
@@ -34,7 +34,9 @@ var QuickSettingsItem = GObject.registerClass({
 
 var QuickToggle = GObject.registerClass({
     Properties: {
-        'label': GObject.ParamSpec.override('label', St.Button),
+        'title': GObject.ParamSpec.string('title', '', '',
+            GObject.ParamFlags.READWRITE,
+            null),
         'icon-name': GObject.ParamSpec.override('icon-name', St.Button),
         'gicon': GObject.ParamSpec.object('gicon', '', '',
             GObject.ParamFlags.READWRITE,
@@ -76,21 +78,26 @@ var QuickToggle = GObject.registerClass({
             GObject.BindingFlags.SYNC_CREATE |
             GObject.BindingFlags.BIDIRECTIONAL);
 
-        this._label = new St.Label({
-            style_class: 'quick-toggle-label',
+        this._title = new St.Label({
+            style_class: 'quick-toggle-title',
             y_align: Clutter.ActorAlign.CENTER,
             x_align: Clutter.ActorAlign.START,
             x_expand: true,
         });
-        this.label_actor = this._label;
-        this._box.add_child(this._label);
+        this.label_actor = this._title;
+        this._box.add_child(this._title);
 
-        this._label.clutter_text.ellipsize = Pango.EllipsizeMode.END;
+        this._title.clutter_text.ellipsize = Pango.EllipsizeMode.END;
 
-        this.bind_property('label',
-            this._label, 'text',
+        this.bind_property('title',
+            this._title, 'text',
             GObject.BindingFlags.SYNC_CREATE);
     }
+
+    set label(label) {
+        console.warn('Trying to set label on QuickToggle. Use title instead.');
+        this.title = label;
+    }
 });
 
 var QuickMenuToggle = GObject.registerClass({
index bde3b80fc51b016600fa8af28f0d35382ed251ea..5618945b7e93beeb898bd039f07518d44242c45f 100644 (file)
@@ -11,7 +11,7 @@ class RotationToggle extends QuickToggle {
         this._systemActions = new SystemActions.getDefault();
 
         super._init({
-            label: _('Auto Rotate'),
+            title: _('Auto Rotate'),
         });
 
         this._systemActions.bind_property('can-lock-orientation',
index bbff62da7fc0bbd27200fc138c04a9cd7c434e14..4b828bd1ee5858b911555a3ae9350ad514c8f401 100644 (file)
@@ -148,7 +148,7 @@ const BtClient = GObject.registerClass({
 const BluetoothToggle = GObject.registerClass(
 class BluetoothToggle extends QuickToggle {
     _init(client) {
-        super._init({label: _('Bluetooth')});
+        super._init({title: _('Bluetooth')});
 
         this._client = client;
 
index 69d5cc31b1c9708866d189e9305de7b6cb3d1bfc..d4620f0843aff6a936d8406139c65a609de27a03 100644 (file)
@@ -8,7 +8,7 @@ const DarkModeToggle = GObject.registerClass(
 class DarkModeToggle extends QuickToggle {
     _init() {
         super._init({
-            label: _('Dark Style'),
+            title: _('Dark Style'),
             iconName: 'dark-mode-symbolic',
         });
 
index 571231d7ab200eb1def920718903af5e5d9a4a6a..9c393b34eb1dcd84297814124659e3078fa2be8c 100644 (file)
@@ -1319,8 +1319,8 @@ const NMToggle = GObject.registerClass({
         this._itemBinding.bind('icon-name',
             this, 'icon-name', GObject.BindingFlags.DEFAULT);
         this._itemBinding.bind_full('name',
-            this, 'label', GObject.BindingFlags.DEFAULT,
-            (bind, source) => [true, this._transformLabel(source)],
+            this, 'title', GObject.BindingFlags.DEFAULT,
+            (bind, source) => [true, this._transformTitle(source)],
             null);
 
         this.connect('clicked', () => this.activate());
@@ -1360,7 +1360,7 @@ const NMToggle = GObject.registerClass({
     // transform function for property binding:
     // Ignore the provided label if there are multiple active
     // items, and replace it with something like "VPN (2)"
-    _transformLabel(source) {
+    _transformTitle(source) {
         const nActive = this.checked
             ? [...this._getActiveItems()].length
             : 0;
index 0d148e3ce770809ef0646750b3cea76f265fd333..5512eaa4aa5cd3a38e7b001cfbad8fd92b43f53d 100644 (file)
@@ -17,7 +17,7 @@ const NightLightToggle = GObject.registerClass(
 class NightLightToggle extends QuickToggle {
     _init() {
         super._init({
-            label: _('Night Light'),
+            title: _('Night Light'),
             iconName: 'night-light-symbolic',
             toggleMode: true,
         });
index 8d2e92846a32dafddadb292fed6cee1dc20e5c2d..eed24557124e8e04de8834b92862efa9d2a6ac50 100644 (file)
@@ -17,17 +17,17 @@ const PowerProfilesProxy = Gio.DBusProxy.makeProxyWrapper(PowerProfilesIface);
 
 const PROFILE_PARAMS = {
     'performance': {
-        label: C_('Power profile', 'Performance'),
+        title: C_('Power profile', 'Performance'),
         iconName: 'power-profile-performance-symbolic',
     },
 
     'balanced': {
-        label: C_('Power profile', 'Balanced'),
+        title: C_('Power profile', 'Balanced'),
         iconName: 'power-profile-balanced-symbolic',
     },
 
     'power-saver': {
-        label: C_('Power profile', 'Power Saver'),
+        title: C_('Power profile', 'Power Saver'),
         iconName: 'power-profile-power-saver-symbolic',
     },
 };
@@ -83,11 +83,11 @@ class PowerProfilesToggle extends QuickMenuToggle {
             .map(p => p.Profile.unpack())
             .reverse();
         for (const profile of profiles) {
-            const {label, iconName} = PROFILE_PARAMS[profile];
-            if (!label)
+            const {title, iconName} = PROFILE_PARAMS[profile];
+            if (!title)
                 continue;
 
-            const item = new PopupMenu.PopupImageMenuItem(label, iconName);
+            const item = new PopupMenu.PopupImageMenuItem(title, iconName);
             item.connect('activate',
                 () => (this._proxy.ActiveProfile = profile));
             this._profileItems.set(profile, item);
index 2e1f98f4d5a35aa4dae50294c632aa8eb6b91403..b51389298049e8d8d19305bde449b21aa350873a 100644 (file)
@@ -93,7 +93,7 @@ const RfkillToggle = GObject.registerClass(
 class RfkillToggle extends QuickToggle {
     _init() {
         super._init({
-            label: _('Airplane Mode'),
+            title: _('Airplane Mode'),
             iconName: 'airplane-mode-symbolic',
         });
 
index 538901d3a07fa086e270006759acb89492dcb22a..308f4772af853baa467f8cd3c2754918ca5cd622 100644 (file)
@@ -87,7 +87,7 @@ const PowerToggle = GObject.registerClass({
         });
 
         this.set({
-            label: _('%d\u2009%%').format(this._proxy.Percentage),
+            title: _('%d\u2009%%').format(this._proxy.Percentage),
             fallback_icon_name: this._proxy.IconName,
             gicon,
         });